package cn.itcast.tanhua.common.utils;

import cn.itcast.tanhua.common.pojo.User;

/**
 * @ClassName UserThreadLocal
 * @Description ThreadLocal
 * @Author WU
 * @Date 2021/5/30 9:08
 * @Version 1.0
 */
public class UserThreadLocal {
    private static final ThreadLocal<User> LOCAL= new ThreadLocal<>();
    private UserThreadLocal(){

    }

    //    将对象放入到ThreadLocal
    public static void set(User user) {
        LOCAL.set(user);
    }

    //    将对象取出
    public static User get() {
       return  LOCAL.get();
    }

    //    删除当前线程中的user对象
    public static void remove() {
        LOCAL.remove();
    }
}
